//package com.batman.baselibrary.widget;
//
//import android.annotation.SuppressLint;
//import android.app.Dialog;
//import android.support.annotation.NonNull;
//import android.support.design.widget.BottomSheetBehavior;
//import android.support.design.widget.BottomSheetDialogFragment;
//import android.support.design.widget.CoordinatorLayout;
//import android.view.View;
//import android.view.Window;
//import android.view.WindowManager;
//
//import com.batman.baselibrary.R;
//
//public class BottomSheetPeekHeightDialogFragment extends BottomSheetDialogFragment {
//
//    private BottomSheetBehavior.BottomSheetCallback mBottomSheetBehaviorCallback = new BottomSheetBehavior.BottomSheetCallback() {
//
//        @Override
//        public void onStateChanged(@NonNull View bottomSheet, int newState) {
//            if (newState == BottomSheetBehavior.STATE_HIDDEN) {
//                dismiss();
//            }
//
//        }
//
//        @Override
//        public void onSlide(@NonNull View bottomSheet, float slideOffset) {
//        }
//    };
//
//
//    @SuppressLint("RestrictedApi")
//    @Override
//    public void setupDialog(Dialog dialog, int style) {
//        super.setupDialog(dialog, style);
//
//        View contentView = View.inflate(getContext(), R.layout.fragment_shopping_cart_bottom_sheet, null);
//
//        dialog.setCanceledOnTouchOutside(false);
//
//        dialog.setContentView(contentView);
//
//        CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) ((View) contentView.getParent()).getLayoutParams();
//        CoordinatorLayout.Behavior behavior = params.getBehavior();
//
//        if (behavior != null && behavior instanceof BottomSheetBehavior) {
//            ((BottomSheetBehavior) behavior).setBottomSheetCallback(mBottomSheetBehaviorCallback);
//            ((BottomSheetBehavior) behavior).setPeekHeight(97);
//            ((BottomSheetBehavior) behavior).setHideable(false);
//        }
//    }
//
//
//    @Override
//    public void onStart() {
//        super.onStart();
//        Window window = getDialog().getWindow();
//        WindowManager.LayoutParams windowParams = window.getAttributes();
//        windowParams.dimAmount = 0.6f;
//        windowParams.flags |= WindowManager.LayoutParams.FLAG_DIM_BEHIND;
//        window.setAttributes(windowParams);
//    }
//}
